package com.fzkj.shejimoshi.Singleton;
public class demo {
    public static void main(String[] args) {

        Singleton instance = Singleton.getInstance();
        Singleton instance1 = Singleton.getInstance();
        System.out.println(instance);
        System.out.println(instance1);
    }
}

class Singleton {
    // 创建一个Singleton实例
    private static Singleton singleton = new Singleton();
    // 提供一个类方法供外界获得实例
    public static Singleton getInstance(){
        return singleton;
    }
}
